package com.yx.shop.service.impl;

import com.yx.shop.dao.TypeDao;
import com.yx.shop.dao.impl.TypeDaoImpl;
import com.yx.shop.entitly.Type;
import com.yx.shop.service.TypeService;
import com.yx.shop.utils.JDBCUtils;

import java.util.List;

/**
 * @Classname TypeServiceImpl
 * @Description TODO:
 * @Date 2021/05/07 11:54
 * @Created by yx
 */
public class TypeServiceImpl implements TypeService {
    private TypeDao typeDao = new TypeDaoImpl();

    @Override
    public List<Type> getAllType() {
        List<Type> typeList = null;
        try {
            JDBCUtils.begin();
            List<Type> types = typeDao.getAllType();
            if (types!=null){
                typeList=types;
            }
            JDBCUtils.commit();
        } catch (Exception e) {
            JDBCUtils.rollback();
            e.printStackTrace();
        }
        return typeList;
    }
}
